<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>面试题</title>
    <!-- 实现思路 定位+tranlate位移 -->
    <style>
        .container{
            width: 500px;
            height: 500px;
            background-color: red;
            margin: 0 auto;
            position: relative;
        }
        .box{
            width: 100px;
            height: 100px;
            background-color: blue;
            position: absolute;
            top: 50%;
            left: 50%;
            transform:translate(-50%,-50%);
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="box"></div>
    </div>
</body>
</html>